Skip to content

close Ralloc heap AFTER TCache destructors - #13

Merged
qtcwt merged 1 commit into
masterfrom
ralloc_holder
Aug 6, 2020
Merged

qtcwt merged 1 commit into
masterfrom
ralloc_holder

Conversation

@qtcwt

@qtcwt qtcwt commented Aug 6, 2020 •

Copy link
Copy Markdown
Member

Previously RP_close, which closes Ralloc heap, has to be called by the end of exit, which however happens before ~TCache.
In order to close the heap after ~TCache so that TCache can properly return cached blocks to superblocks, we now create a static RAII RallocHolder object in RP_init, whose constructor calls the real function body of RP_init (now named as _RP_init) so that achieves the ordering where ~TCache is sequenced-before ~RallocHolder, i.e., closing the heap.

Here is the link that explains "the last destructor for thread-local objects is sequenced-before the first destructor for a static object."

Issue #12 reports a runtime error when recovery happens. It's suspected that this fix may also fix that issue but haven't been tested yet.

Using static RAII RallocHolder to achieve the sequenced-before ordering
of these destructors
@qtcwt qtcwt linked an issue Aug 6, 2020 that may be closed by this pull request
@qtcwt
qtcwt merged commit 744f55f into master Aug 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant